WPP:RegisterAction("TOOL", "Tool", "Edit an entity with the tool gun.");

WPP:SetWorldAcess(WPP_TOOL, true)

WPP:RegisterAction("REMOVE", "Remove", "Remove an entity with the remover tool.");

WPP:LinkTools(WPP_REMOVE,"remover");

WPP:SetWorldAcess(WPP_REMOVE, false)

WPP:RegisterAction("DUPLICATE", "Duplicate", "Copy a contraption with the duplicator or advanced duplicator tools.");

WPP:LinkTools(WPP_DUPLICATE,"duplicator","adv_duplicator");

WPP:SetWorldAcess(WPP_DUPLICATE, false)

function WPP.CanTool(Player,Trace,Mode)
	if ( !Trace.Entity ) or ( Trace.Entity:IsWorld() ) then
		return;
	end
	
	if ( !WPP:IsValid(Trace.Entity) ) then
		return false;
	end
	
	local Index = WPP:GetFromTool(Mode);
	
	return WPP:ValidateAction(Index,Trace.Entity,Player);
end

hook.Add("CanTool","WPP-CanTool",WPP.CanTool);

